home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 8
/
Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso
/
Aminet
/
comm
/
dlg
/
DiaUpDwn.lha
/
DiaUpDwn.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-02
|
3KB
|
105 lines
/* $VER: DiaUpDown V1.0 (2 Jul 1995) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <dialog/dlg_pragmas.h>
#include <dialog/user.h>
#include <dialog/resman.h>
#define __USE_SYSBASE
#include <proto/exec.h>
#include <proto/dos.h>
#include <clib/exec_protos.h>
#include <clib/locale_protos.h>
#define MINOSVER 37
#define VERSION_NAG \
"\nYou have neglected your responsibility to upgrade\n"\
"your system software to version 2.04 or greater!\n\n"
#define DLGERROR \
"\nDiaUpDown error: Can't open dlg.library!\n\n"
#define PORTERROR \
"\nDiaUpDown error: Can't find port!\n\n"
#define USERERROR \
"\nDiaUpDown error: Can't find user!\n\n"
#define HEADER \
"\x1b[1m
DiaUpDown V1.0\x1b[0m -- View quick down/upload statics.\n"\
"Written by Janne Saarme 1995\n\n" \
"Usage: DiaUpDown\n\n" \
"Read ReadMe for more instructions.\n\n"
struct Ram_File rammies;
struct USER_DATA userdata;
APTR DLGBase;
void sulkemiset(void);
char port[4]="???",title[80];
long download;
void main(int ac, char **arg)
{
if(ac>1) {
Write(Output(), HEADER, sizeof(HEADER));
exit(0);
}
if(((struct Library *)SysBase)->lib_Version<MINOSVER ||
DOSBase->dl_lib.lib_Version<MINOSVER) {
Write(Output(), VERSION_NAG, sizeof(VERSION_NAG));
exit(0);
}
if (!(DLGBase = OpenLibrary("dlg.library", 0))) {
Write(Output(), DLGERROR, sizeof(DLGERROR));
sulkemiset();
}
if (GetDevName(port)==-1) {
Write(Output(), HEADER, sizeof(HEADER));
Write(Output(), PORTERROR, sizeof(PORTERROR));
sulkemiset();
}
if(!ReadRam(&rammies, port)) {
Write(Output(), USERERROR, sizeof(USERERROR));
sulkemiset();
}
TGetTitle(title, port);
TTitle("DiaUpDown V1.0 - (C) by Janne Saarme 1995", port);
ReadUser(&rammies,&userdata, port);
Printf("\nHere is some quick download and uploads statics");
Printf("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
Printf("\nUploads (%ld/%4ldKB) / Downloads (%ld/%4ldKB).", userdata.Files_Uploaded, (userdata.Bytes_Uploaded)/1000, userdata.Files_Downloaded, (userdata.Bytes_Downloaded)/1000);
if(userdata.Ratio==0) Printf("\nYou don't have any download ratios.\n\n");
else {
download=(userdata.Bytes_Uploaded*userdata.Ratio)-userdata.Bytes_Downloaded;
Printf("\nDownload ratio is 1:%ld (bytes). You have %ldKB left.\n\n", userdata.Ratio, (download)/1000);
}
Flush(Output());
sulkemiset();
}
void sulkemiset()
{
TTitle(title, port);
if (DLGBase) CloseLibrary(DLGBase);
exit(0);
}